﻿using AutoMapper;
using BlogDemo.Application.BlogApp.Dtos;
using BlogDemo.Core.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BlogDemo.Application.BlogApp.Profiles
{
    internal class BlogProfile : Profile
    {
        public BlogProfile()
        {
            //CreateMap<Source, Dest>()

            CreateMap<Blog, BlogDto>()
                .ForMember(dest => dest.BlogId, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.Links, opt => opt.Ignore())
                //.ForMember(dest => dest.Timestamp, opt => opt.MapFrom(src => src.Timestamp))

                ;
            CreateMap<BlogDto, Blog>()
                    .ForMember(dest => dest.Image, opt => opt.Ignore())
                    .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.BlogId))
                    ;
        }
    }
}
